Построение идеальной хеш-таблицы (без коллизий)
Мартиросян Елизавета, Максимов Антон
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
sns.set_style("whitegrid")
idealHashing_results_int = pd.read_csv('results/idealHashing/int.out', sep=';', index_col=False)
twoTieredApproach_results_int = pd.read_csv('results/twoTieredApproach/int.out', sep=';', index_col=False)
graphHashing_results_int = pd.read_csv('results/graphHashing/int.out', sep=';', index_col=False)
idealHashing_results_string = pd.read_csv('results/idealHashing/string.out', sep=';', index_col=False)
twoTieredApproach_results_string = pd.read_csv('results/twoTieredApproach/string.out', sep=';', index_col=False)
graphHashing_results_string = pd.read_csv('results/graphHashing/string.out', sep=';', index_col=False)
idealHashing_results_real = pd.read_csv('results/idealHashing/real.out', sep=';', index_col=False)
twoTieredApproach_results_real = pd.read_csv('results/twoTieredApproach/real.out', sep=';', index_col=False)
graphHashing_results_real = pd.read_csv('results/graphHashing/real.out', sep=';', index_col=False)
idealHashing_results_int
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=idealHashing_results_int, height=3, aspect=1, order=2)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=idealHashing_results_string, height=3, aspect=1, order=2)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=idealHashing_results_real, height=3, aspect=1, order=2)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=idealHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=idealHashing_results_int, height=3, aspect=1, order=2)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=idealHashing_results_string, height=3, aspect=1, order=2)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=idealHashing_results_real, height=3, aspect=1, order=2)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=idealHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=twoTieredApproach_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="hashing time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="processed memory(KB)", hue="size", col="size",
data=graphHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="p", y="average search time(microseconds/10^-6 sec)", hue="size", col="size",
data=graphHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="hashing time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="processed memory(KB)", hue="p", col="p",
data=graphHashing_results_real, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_int, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_string, height=3, aspect=1, order=1)
g = sns.lmplot(x="size", y="average search time(microseconds/10^-6 sec)", hue="p", col="p",
data=graphHashing_results_real, height=3, aspect=1, order=1)
def getBestSolution(results, col_name, sizes):
avg_values = []
for size in sizes:
min_value = results[results['size'] == size]['hashing time(microseconds/10^-6 sec)'].min()
table = results[results['hashing time(microseconds/10^-6 sec)'] == min_value]
best_value = table[col_name].values[0]
avg_values.append(best_value)
return avg_values
def draw(col_name, arr1, arr2, arr3, sizes=None):
if sizes is None:
sizes = idealHashing_results_int['size'].unique()
avg_search_values_idealHashing = getBestSolution(arr1, col_name, sizes)
avg_search_values_twoTieredApproach = getBestSolution(arr2, col_name, sizes)
avg_search_values_graphHashing = getBestSolution(arr3, col_name, sizes)
df = pd.DataFrame([sizes,
avg_search_values_idealHashing,
avg_search_values_twoTieredApproach,
avg_search_values_graphHashing],
index=['size', 'Ideal Hashing', 'Two tiered approach', 'Graph hashing']).T
if col_name == 'average search time(microseconds/10^-6 sec)':
sns.lmplot(x="size", y="Ideal Hashing", data=df, order=1)
else:
sns.lmplot(x="size", y="Ideal Hashing", data=df, order=2)
sns.lmplot(x="size", y="Two tiered approach", data=df, order=1)
sns.lmplot(x="size", y="Graph hashing", data=df, order=1)
plt.figure(figsize=(20, 10))
g = sns.lineplot(data=df[ ['Ideal Hashing', 'Two tiered approach', 'Graph hashing'] ],
markers=True, dashes=False, linewidth=5, markersize=10)
g.tick_params(labelsize=16)
g.set_xlabel("Data size",fontsize=16)
g.set_ylabel(col_name,fontsize=16)
plt.setp(g.get_legend().get_texts(), fontsize='16')
plt.show()
draw('hashing time(microseconds/10^-6 sec)', idealHashing_results_int, twoTieredApproach_results_int, graphHashing_results_int)
draw('hashing time(microseconds/10^-6 sec)',
idealHashing_results_string,
twoTieredApproach_results_string,
graphHashing_results_string)
draw('hashing time(microseconds/10^-6 sec)',
idealHashing_results_real,
twoTieredApproach_results_real,
graphHashing_results_real)
draw('average search time(microseconds/10^-6 sec)', idealHashing_results_int, twoTieredApproach_results_int, graphHashing_results_int)
draw('average search time(microseconds/10^-6 sec)',
idealHashing_results_string,
twoTieredApproach_results_string,
graphHashing_results_string)
draw('average search time(microseconds/10^-6 sec)',
idealHashing_results_real,
twoTieredApproach_results_real,
graphHashing_results_real)
draw("processed memory(KB)", idealHashing_results_int, twoTieredApproach_results_int, graphHashing_results_int)
draw("processed memory(KB)",
idealHashing_results_string,
twoTieredApproach_results_string,
graphHashing_results_string)
draw("processed memory(KB)",
idealHashing_results_real,
twoTieredApproach_results_real,
graphHashing_results_real)